rev 0 : 28/03/2022
MAJ : 26/04/2022
Migration du Projet DIGIT3000 sur XC8
Pourquoi ? :
Obsolescence programmée de MikroC (plus d'evolution depuis 2019)
plus de portabilité .. avec un outil Gratuit XC8 ( meme si moins
performant que MikroC, en version gratuite)
MikroC Pro nécessite une clé d'acces à > 220
S'aiguiser à la migration sur XC8 , avec une Application, un
programme connu . (auto-formation)
Lister les points clés de correspondances entre les compilateurs
MikroC et XC8
Differences
entre les compilateurs MikroC .... XC8
1er
TEST avec version MPLABX IDE 5.30 et XC8 (2.32)
Upgrade
MPLABX de 5.30 vers 6.00
Upgrade
XC8 2.32 vers 2.36
Probleme
de manque de ressource RAM pour utiliser MPLABX !
Rajout
de 8go RAM => passe de 4 à 12Go
Le
programme complet finalisé en version MPLABX 6.00 XC8
Test comparatif sur taille et vitesse d'execution ( maybe ?)
MikroC | XC8 | Notes. | remarques . |
occupe 600 Mo sur disque C: | occupe 6,7Go sur disque C: | XC8 comprend famille AVR,ATMEL,PIC16,24,DSP | |
WordToStr (value,*destination) | utoa(*dest ,value, 10) | inversion entre destination et source , Base 10 | utoa ne formatte pas la sortie , WordoStr sur 6 chars |
HexTosStr(value,*destination) | utoa(*dest ,value, 16 | en base 16 , resultat de sortie en Hexa | mais gere en plus, la base |
p0> 0 | p0!=NULL | incompatibilié entre 0 et NULL ? | Test valeur Pointeur |
EErom_Write (adress 16b, byte value) | DATAEE_WriteByte | similaire | |
value=EEprom_Read (adresse 16b) | DATAEE_ReadByte | similaire | |
U1RXIE_bit=0; | PIE3bits.U1RXIE=0; | rajout systematique de bits apres le nom de registre | ecriture des registre ou bits plus lourde ! |
LongToStr(L1,CRam1) | ltoa(CRam1,L1,10) | inversion entre destination et source , Base 10 | ltoa ne formatte pas la sortie , LongToStr sur 15 chars |
_asm Reset ; | asm("reset"); | ||
Delay_ms(1000); | __delay_ms(1000); | ||
pas d'init Eeprom via le code C | __EEPROM_DATA(0, 1, 2, 3, 4, 5, 6, 7); | possibilité d'initialiser l'Eeeprom dans le code | outil MikroC eeprom avec bug |
sprinf(txt,Cpt_T1 %5d ; EA1=%05d soit %3.1f%% \r\n ",Cpt_T1,EA1,F1); | idem | sortie formatée entier, flottant | |
...... | MCC tools | outil de configuration de spins du PIC | tres utile avec la fonction PPS |
4Go de RAM PC | 12GO de RAM PC | MPLABX 6.00 tres gourmant en ressources |
1er
Text avec Version MPLABX 5.30 et XC8
28/03/2022
Projet MPLABX (version 5.30) : Clavier_D3000_18F27K42
Version : 2022-0329
Compile le Mar 29 2022 a 16:37:04 UTC
avec version XC8 : 2320
Hardware : Breadboard 18F27K42 + clavier 4x3 Tandy ...FOSC
interne =64MHz
usage des interrupts vectorisées (ITV) | Ok |
Activation UART | Ok |
Test ITV nterrupt Reception UART | Ok |
test ITV Timer1... à 100mS | Ok |
Test ITV Timer4 ...à 500mS | Ok |
Test SMT1 compteur 24 bits | Ok |
Test NCO1 generateur de frequence | Ok |
Test Initi., Lecture et Ecriture Eeprom | Ok |
Test Mesure ADC 12bits ...RB5 | Ok |
Fonctions | |
void Play_Note_via_NCO( float Fr, int Duree) | Ok |
void Play_Melodie(char Num, char Visu) | Ok |
Sauve_Parametres_en_Eeprom() | Ok |
Relecture_Eeprom(char visu) | Ok |
Restitue_Parametres_en_Eeprom() | Ok |
unsigned char Saisie_1_Touche (void) | Ok |
void Saisie_4_Touches(void) | Ok |
Trace programme sur sortie UART
Usage du Pickit3 + programme Picki3minus.exe
pour programmer le pPIC18F27K42 ,in Situ
Alimentation PIC via alim. 5V externe ..
Tools -> Target Vdd source -> Autodetect
(Testé OK, même avec R=2,2K
en pull down sur RB6 et RB7 ..)
Toute_Premiere_Init() | Ok |
void Saisie_Code(void) | Ok |
Toute 1ere Init
.. OK
pour en arriver à Etape 0
Etape 0
Saisie code Progr. ou code cde Relais (4 digits)
MSabotage=0
Attente 4 frappes clavier
.Idx=*T1*;G0*Z3031*OActive *;*RR255G0B0*;*H R1=OFF*;*CR255G0B0*;*I
*;*DR0G0B0*;*J *;*ER0G0B0*;*K *;*FR0G0B0*;*W *;*NR0G0B0*;
.Idx=*T2*;G0*Z3023*OActive *;*RR255G0B0*;*H R1=OFF*;*CR255G0B0*;*I
*;*DR0G0B0*;*J *;*ER0G0B0*;*K *;*FR0G0B0*;*W *;*NR0G0B0*;
.Idx=*T3*;G0*Z3028*OActive *;*RR255G0B0*;*H R1=OFF*;*CR255G0B0*;*I
*;*DR0G0B0*;*J *;*ER0G0B0*;*K *;*FR0G0B0*;*W *;*NR0G0B0*;
.Upgrade
vers MPLABX IDE 6.00
Chargement de MPLABX-v6.00-windows-installer.exe
charge MPLABX IDE
charge MPLAX IPE
nota : pas de directory PickiT3 ..?.
XC8 conservé en Version 2.32
Product Version: MPLAB X IDE v6.00
Updates: Updates available
Java: 1.8.0_292; OpenJDK 64-Bit Server VM 25.292-b10
Runtime: OpenJDK Runtime Environment 1.8.0_292-b10
System: Windows 10 version 10.0 running on amd64; Cp1252; fr_FR (mplab)
User directory: C:\Users\Paul\AppData\Roaming\mplab_ide\dev\v6.00
listing détaillé du directory Microchip :
voir Liste_Microchip_MPLABX-6.0_2022-0330.txt
Dossiers C:\Program Files\Microchip
Dossiers = 2 391,
Fichiers = 39 411,
Octets = 6 113 551 553
compilation de
l'application
Non line specific
message::: warning: (1020) unknown attribute "CFGPROG"
in chipinfo file "C:/Users/Paul/.mchp_packs/Microchip/PIC18F-K_DFP/1.6.125/xc8\pic\dat\ini\18f27k42.ini"
at line 156
Non line specific message::: warning: (1020) unknown attribute
"USERIDPROG"
in chipinfo file "C:/Users/Paul/.mchp_packs/Microchip/PIC18F-K_DFP/1.6.125/xc8\pic\dat\ini\18f27k42.ini"
at line 6424
Memory Summary:
Program space used B696h ( 46742) of 20000h bytes ( 35.7%)
Data space used AC0h ( 2752) of 2000h bytes ( 33.6%)
Configuration bits used 5h ( 5) of 5h words (100.0%)
EEPROM space used D0h ( 208) of 400h bytes ( 20.3%)
ID Location space used 0h ( 0) of 10h bytes ( 0.0%)
"Calculating checksum"
make[2]: Leaving directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
make[1]: Leaving directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
BUILD SUCCESSFUL (total time:
1m 47s)
Loading code from C:/MPLABX_Projects/Clavier_D3000_18F27K42.X/dist/default/production/
Clavier_D3000_18F27K42.X.production.hex...
Edition du fichier
18f27k42.ini avec notepad++
C:\Program Files\Microchip\MPLABX\v6.00\packs\Microchip\PIC18F-K_DFP\1.5.114\xc8\pic\dat\ini\18f27k42.ini
[18F27K42]
ARCH=PIC18XV
BSRBITS=0x6
CFGMEM=300000-300009
CFGPROG=2,1,2 <--- ligne
156
COMMON=00-5F
DEVIDMEM=3FFFFE-3FFFFF
EEADRBITS=0xA
EEPROM=310000-3103FF
FAMILY=18fxxk42
FLASH_EW=80,80
STACKDEPTH=1F
USERIDMEM=200000-20000F
USERIDPROG=1,2,2 <---- at
line 6424
VOLSFRS=39E5-39E6,3ABF-3ABF
un upgrade du fichier :
PIC18F-K_DFP\1.5.114\xc8\pic\dat\ini\18f27k42.ini
par pack,PIC18F-K_DFP,1.6.125,Microchip
n'y change rien !
Meme probleme rencontré par SATINAS .. voir Fantaspic
=>retour à pack,PIC18F-K_DFP,1.4.87
,Microchip
plus de message d'alerte
recherche sur forum Microchip :
https://www.microchip.com/forums/m1200231.aspx
probleme necessitant un Upgrade XC8 !
Upgrade
XC8 2.32 vers 2.36
31/03/2022
https://microchipdeveloper.com/tls0101:get-compiler
bizarre : le clic sur la page ne fait rien ...
obligé de copier le lien dans la barre de recherche google
chrome
xc8-v2.36-full-install-windows-x64-installer.exe
pese 68,8Mo !
installation:
C:\Program Files\Microchip\xc8\v2.36
1ere compilation avec ce nouvel environnement :
1ere compilation
CLEAN SUCCESSFUL (total
time: 94ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
make -f nbproject/Makefile-default.mk dist/default/production/Clavier_D3000_18F27K42.X.production.hex
make[2]: Entering directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
"C:\Program Files\Microchip\xc8\v2.36\bin\xc8-cc.exe" -mcpu=18F27K42
-c -mdfp="C:/Users/Paul/.mchp_packs/Microchip/PIC18F-K_DFP/1.6.125/xc8"
-fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile
-maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default
-msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init
-mno-keep-startup -mno-download -mno-default-config-bits -std=c90
-gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/main.p1
main.c
"C:\Program Files\Microchip\xc8\v2.36\bin\xc8-cc.exe" -mcpu=18F27K42
-c -mdfp="C:/Users/Paul/.mchp_packs/Microchip/PIC18F-K_DFP/1.6.125/xc8"
-fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile
-maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default
-msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init
-mno-keep-startup -mno-download -mno-default-config-bits -std=c90
-gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/_ext/248969578/memory.p1
C:/MPLABX_Projects/Clavier_D3000_18F27K42.X/mcc_generated_files/memory.c
main.c:112:28: warning: (162) #warning: "use C90 for ultoa"
main.c:535:64: warning: (1316) attribute/specifier "__interrupt"
ignored
main.c:536:65: warning: (1316) attribute/specifier "__interrupt"
ignored
main.c:537:65: warning: (1316) attribute/specifier "__interrupt"
ignored
main.c:1328:8: warning: (228) illegal character (0xB0)
main.c:3625:8: warning: (228) illegal character (0xE0)
main.c:3806:8: warning: (228) illegal character (0xE9)
main.c:3877:8: warning: (228) illegal character (0xE9)
main.c:3922:8: warning: (228) illegal character (0xE9)
main.c:3949:10: warning: (228) illegal character (0xE9)
Compilateur en actio > 12
minutes ! (avec
programme partiel !)
l'horloge PC s'arrete, La souris ne répond plus.. je n'ai plus
la main sur le PC .. l'écran s'eteint par moment ..
tout laisse croire que le PC est planté ( hors le bruit sur
disque dur ..) c'est Ouf!
"C:\Program Files\Microchip\xc8\v2.36\bin\xc8-cc.exe" -mcpu=18F27K42 -Wl,-Map=dist/default/production/Clavier_D3000_18F27K42.X.production.map
-DXPRJ_default=default -Wl,--defsym=__MPLAB_BUILD=1 -mdfp="C:/Users/Paul/.mchp_packs/Microchip/PIC18F-K_DFP/1.6.125/xc8"
-fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile
-maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,
-a -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init
-mno-keep-startup -mno-download -mno-default-config-bits -std=c90
-gdwarf-3 -mstack=compiled:auto:auto:auto -Wl,--memorysummary,dist/default/production/memoryfile.xml
-o dist/default/production/Clavier_D3000_18F27K42.X.production.elf
build/default/production/main.p1 build/default/production/_ext/248969578/memory.p1
Non line specific message::: advisory: (1492) using updated 32-bit
floating-point libraries; improved accuracy might increase code
size
Memory Summary:
Program space used CF18h ( 53016) of 20000h bytes ( 40.4%)
Data space used AC0h ( 2752) of 2000h bytes ( 33.6%)
Configuration bits used 5h ( 5) of 5h words (100.0%)
EEPROM space used D0h ( 208) of 400h bytes ( 20.3%)
ID Location space used 0h ( 0) of 10h bytes ( 0.0%)
"Calculating checksum"
make[2]: Leaving directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
make[1]: Leaving directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
BUILD
SUCCESSFUL (total time: 12m 5s)
Loading code from C:/MPLABX_Projects/Clavier_D3000_18F27K42.X/dist/default/production/Clavier_D3000_18F27K42.X.production.hex...
Program loaded with pack,PIC18F-K_DFP,1.6.125,Microchip
Loading completed
PROBLEME
de ressources PC
Un 2em test de compilation
... prend 37
minutes ! .. PC
occupé à 100% ...
Le PC doit passer / perdre son temps à SWAPPER entre RAM et Page
SYS sur DISQUE DUR !
Nota : La meme application , prend moins de 2mn sous MikroC pour
etre compilée !
Resssources PC :
RAM installée 4GO en DDR3 ..
déja occupée à 46% SANS AVOIR LANCE UNE APPLICAION !
En allégeant la charge
de mon PC :
Supprimé mon 2 em ecran 19" en 1920x1080
Diminué la resolution de mon ecran principal 1920x1080 ->
passé à 1350x768
Enlevé l'image d'arriere plan ... j'ai gagné environ 100Mo de
RAM
Relance d'une compilation ... PC toujours innacessible pendant la
compilation !
le niveau de priorité est pourtant sur NORMAL pour MPLABX
CLEAN SUCCESSFUL (total
time: 90ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
make -f nbproject/Makefile-default.mk dist/default/production/Clavier_D3000_18F27K42.X.production.hex
make[2]: Entering directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
"C:\Program Files\Microchip\xc8\v2.36\bin\xc8-cc.exe" -mcpu=18F27K42
-c -mdfp="C:/Users/Paul/.mchp_packs/Microchip/PIC18F-K_DFP/1.6.125/xc8"
-fno-short-double -fno-short-float -memi=wordwrite -O0 -maddrqual=ignore
-mwarn=-3 -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file
-ginhx32 -Wl,--data-init -mno-keep-startup -mno-download -mno-default-config-bits
-std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/main.p1
main.c
"C:\Program Files\Microchip\xc8\v2.36\bin\xc8-cc.exe" -mcpu=18F27K42
-c -mdfp="C:/Users/Paul/.mchp_packs/Microchip/PIC18F-K_DFP/1.6.125/xc8"
-fno-short-double -fno-short-float -memi=wordwrite -O0 -maddrqual=ignore
-mwarn=-3 -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file
-ginhx32 -Wl,--data-init -mno-keep-startup -mno-download -mno-default-config-bits
-std=c90 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/_ext/248969578/memory.p1
C:/MPLABX_Projects/Clavier_D3000_18F27K42.X/mcc_generated_files/memory.c
main.c:112:28: warning: (162) #warning: "use C90 for ultoa"
main.c:539:55: warning: (1316) attribute/specifier "__interrupt"
ignored
main.c:540:55: warning: (1316) attribute/specifier "__interrupt"
ignored
main.c:541:56: warning: (1316) attribute/specifier "__interrupt"
ignored
main.c:542:65: warning: (1316) attribute/specifier "__interrupt"
ignored
debut de
compilation
"C:\Program Files\Microchip\xc8\v2.36\bin\xc8-cc.exe"
-mcpu=18F27K42 -Wl,-Map=dist/default/production/Clavier_D3000_18F27K42.X.production.map
-DXPRJ_default=default -Wl,--defsym=__MPLAB_BUILD=1 -mdfp="C:/Users/Paul/.mchp_packs/Microchip/PIC18F-K_DFP/1.6.125/xc8"
-fno-short-double -fno-short-float -memi=wordwrite -O0 -maddrqual=ignore
-mwarn=-3 -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init
-mno-keep-startup -mno-download -mno-default-config-bits -std=c90
-gdwarf-3 -mstack=compiled:auto:auto:auto -Wl,--memorysummary,dist/default/production/memoryfile.xml
-o dist/default/production/Clavier_D3000_18F27K42.X.production.elf
build/default/production/main.p1 build/default/production/_ext/248969578/memory.p1
Non line specific message::: advisory: (1492) using updated 32-bit
floating-point libraries; improved accuracy might increase code
size
Memory Summary:
Program space used D701h ( 55041) of 20000h bytes ( 42.0%)
Data space used B37h ( 2871) of 2000h bytes ( 35.0%)
Configuration bits used 5h ( 5) of 5h words (100.0%)
EEPROM space used E0h ( 224) of 400h bytes ( 21.9%)
ID Location space used 0h ( 0) of 10h bytes ( 0.0%)
"Calculating checksum"
make[2]: Leaving directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
make[1]: Leaving directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
BUILD SUCCESSFUL (total time: 23m 29s)
Loading code from C:/MPLABX_Projects/Clavier_D3000_18F27K42.X/dist/default/production/Clavier_D3000_18F27K42.X.production.hex...
Program loaded with pack,PIC18F-K_DFP,1.6.125,Microchip
Loading completed
* Le pickit3 est reconnu dans les
Tools MPLABX, mais il ne le lance pas ?
* mais je peux utiliser Pickit3minus.exe, en externe , Stand
alone programme,
pour charger le programme dans le PIC .. OK ... programme running
...OK *
ou directement via MPLABX si je choisis le Pickit4 ,
qui charge automatiquement le *.Hex dans la foulée ..apres
compilation
conclusion de ce jour :
23 min c'est encore beaucoup trop !
Rajouter de la RAM !
Rajout de 8Go de
RAM
Barette de 8Go DDR3 240 pins 1600MHz CL11 .. achetée chez ASUS
Accessoire ( 49+5=54)
installée sur Slot #1
et déplacé ma barette de 4Go sur Slot #2
Verification avec commande systeminfo dans
fenetre MSDOS :
Mémoire physique totale: 12 168 Mo
Mémoire virtuelle : taille maximale: 14 216 Mo
.. et ça change tout !
Test compilation :
09/04/2022
CLEAN SUCCESSFUL (total time: 89ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
make -f nbproject/Makefile-default.mk dist/default/production/Clavier_D3000_18F27K42.X.production.hex
make[2]: Entering directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
....etc ......
Non line specific message::: advisory: (1492) using updated 32-bit
floating-point libraries; improved accuracy might increase code
size
"Calculating checksum"
make[2]: Leaving directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
make[1]: Leaving directory 'C:/MPLABX_Projects/Clavier_D3000_18F27K42.X'
BUILD
SUCCESSFUL (total time: 1m 12s)
Loading code from C:/MPLABX_Projects/Clavier_D3000_18F27K42.X/dist/default/production/Clavier_D3000_18F27K42.X.production.hex...
Program loaded with pack,PIC18F-K_DFP,1.6.125,Microchip
Loading completed
Conclusion :
MPLABX 6.00 est tres gourmant en
ressources et in fine, avec 12Go de RAM,
l'usage en est bien plus confortable .
SOFTWARE Digi3000
version MPLABX IDE 6.0 et XC8 2-36
customisation du projet :
SOFTWARE Files :
Clavier_D3000_18F27K42.X_2022-0426.zip
Chargeur : Clavier_D3000_18F27K42.X.production_2022-0426.hex
(131Ko)
Include : Melodies_Clavier_en_Ram_2022-0325_to_include.c
(15ko)
Main source : main_2022-0426.c (133ko)
à noter : Le pickit3 avec
Pickitminus.exe est OK avec le PIC18F2742 ..
..... à Suivre .. si il me reste du courage apres ces nombreux
periples
Difference MikroC et MPLAB
Test comparatif MikroC et MPLABX +XC8